package com.chinasoft.reposearch.entity.po;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * ElasticRequestParams类用于封装Elasticsearch请求的参数
 * 该类包含了搜索索引的各种条件和排序参数。
 * sort可选参数有star,recent,fork,watcher。
 * order可选参数有ASC,DESC。
 * page默认0，size默认10。
 */
@Data
@AllArgsConstructor
public class ElasticRequestParams {
    String indexName = "repo";
    String keyWord;
    String language;
    Map<String, Float> fieldWeights = new HashMap<>();
    String[] topic;
    String sort = "star";//star,recent,fork,watcher
    String order = "desc";//ASC,DESC
    int page = 0;
    int size = 10;
    public ElasticRequestParams() {
        fieldWeights.put("name", 2.0f);
        fieldWeights.put("description", 1.0f);
    }
}
